package com.cgs.query.service

import com.cgs.query.domain.QuerySource

/**
 * 数据源业务接口
 */
interface IQuerySourceService {

    fun save(source: QuerySource): QuerySource

    fun delete(id: String)

    fun findById(id: String): QuerySource?

    fun findAll(): List<QuerySource>?

    /**
     * 查询没有锁定的数据源
     */
    fun findByUnLock(projectName: String?): List<QuerySource>?

    fun findAll(pn: Int, ps: Int): Any?

    /**
     * 查询数据源
     * 通过项目名称
     */
    fun findByProjectName(projectName: String): QuerySource?

    fun findSourceIdByDefineNameAndProjectName(defineName: String, projectName: String): String?

    fun findSourceIdByDefineNameAndTagNameAndProjectName(defineName: String, tagName: String, projectName: String): String?

    /**
     * 查询数据源id
     * 通过定义名、别名、项目名称
     */
    fun findSourceIdByDefineNameAndAliasAndProjectName(defineName: String, alias: String, projectName: String): String?

    /**
     * 数据源存在
     */
    fun exist(source: QuerySource): Boolean

}